package cn.edu.zafu.bigdata.rwx;

import java.util.*;
import java.io.*;
import java.nio.file.*;

/**
 * @author wc
 */
public class RhymingWordsFinder {
    private static final Map<String, List<String>> RHYMES = new HashMap<>();
    public static void main(String[] args) throws IOException {
        Files.readAllLines(Paths.get("files", "words.txt")).forEach(word -> RHYMES.computeIfAbsent(word.length() < 3 ? word : word.substring(word.length() - 3), k -> new ArrayList<>()).add(word));
        RHYMES.values().forEach(System.out::println);
    }
}
